package com.xxx.forward;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class ServletDome01 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //请求转发
        System.out.println("ServletDome01");
        RequestDispatcher requestDispatcher = req.getRequestDispatcher("/f03");
        requestDispatcher.forward(req, resp);
        resp.setHeader("f02", "f02");
        resp.getWriter().write("f02");
    }
}
